/**
 * 
 *   Code contributed by IUP Research Institute
 * 
 *     This file is part of NetworkMon.
 *
 *   NetworkMon is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; version 2 of the License.
 *
 *   NetworkMon is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NetworkMon; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
package networkbackend;

/**
 * 
 * @author fkern
 */
public class PacketListenerHandler implements PacketEventListenerInterface {

	private packetQueue listenerQueue;

	/** Creates a new instance of PacketListener */
	public PacketListenerHandler(packetQueue queue) {
		listenerQueue = queue;

	}

	public void APacketHasBeenCapturedOccurred(Object evt) {

		APacket receivedPacket = (APacket) evt;

		// String src, String dest, int srcPort, int destPort, int prot, int len
		PacketNode newNode = new PacketNode(
				receivedPacket.getSourceIPAddress(), receivedPacket
						.getDestinationIPAddress(), receivedPacket
						.getSourcePortNumber(), receivedPacket
						.getDestinationPortNumber(), receivedPacket
						.getProtocall(), receivedPacket.getTheSize(),
				receivedPacket.getSendersName(), receivedPacket
						.getReceiversName());

		listenerQueue.Save(newNode);

	}

}
